﻿<!--*************************************************************************************

   Toolkit for WPF

   Copyright (C) 2007-2016 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  ***********************************************************************************-->
<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.CheckLists.Views.CheckListsView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
                 xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                 xmlns:s="clr-namespace:System;assembly=mscorlib"
                 x:Name="demo"
                 Title="Check lists">
    <local:DemoView.Description>
        <Paragraph FontSize="14" FontFamily="Segoe">
            The CheckListBox and CheckComboBox controls represent a list of selected items that are displayed as CheckBoxes. Besides the common SelectedItem and SelectedItems properties, these controls give developers more alternatives for managing and handling selections.
        </Paragraph>
    </local:DemoView.Description>

   <local:DemoView.Resources>
      <x:Array x:Key="personProperties" Type="s:String">
         <s:String>ID</s:String>
         <s:String>FirstName</s:String>
         <s:String>LastName</s:String>
      </x:Array>
   </local:DemoView.Resources>

   <Grid >
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
      </Grid.RowDefinitions>

      <GroupBox Header="Features" Grid.Row="0" Margin="5">
         <Grid>
            <Grid.RowDefinitions>
               <RowDefinition />
               <RowDefinition />
               <RowDefinition />
               <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto"/>
               <ColumnDefinition Width="Auto"/>
               <ColumnDefinition Width="Auto"/>
               <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" 
                       Text="Delimiter:" 
                       Margin="2,5,5,5"/>
            <TextBox x:Name="_delimiter" 
                     Grid.Row="0" Grid.Column="1"
                     Width="200"
                     Margin="5"
                     HorizontalAlignment="Left"
                     Text="," />

            <TextBlock Grid.Row="1" Grid.Column="0" 
                       Text="ValueMemberPath:" 
                       Margin="2,5,5,5"/>
            <ComboBox x:Name="_valueMemberPath" 
                     Grid.Row="1" Grid.Column="1"
                     HorizontalAlignment="Left"
                     Width="100"
                     Margin="5"
                     ItemsSource="{StaticResource personProperties}" 
                     SelectedIndex="0"/>

            <TextBlock Grid.Row="2" Grid.Column="0" 
                       Text="SelectedValue:" 
                       Margin="2,5,5,5"/>
            <TextBox x:Name="_selectedValue" 
                     Grid.Row="2" Grid.Column="1"
                     Width="200"
                     Margin="5"
                     HorizontalAlignment="Left"
                     Text="{Binding ElementName=_checkListBox, Path=SelectedValue, Mode=TwoWay}"/>

            <TextBlock Grid.Row="3" Grid.Column="0" 
                       Text="SelectedMemberPath:" 
                       Margin="2,5,5,5"/>
            <TextBox x:Name="_selectedMemberPath" 
                     Grid.Row="3" Grid.Column="1"
                     Margin="5"
                     Width="125"
                     HorizontalAlignment="Left"
                     IsEnabled="False"
                     Text="IsSelected" />

            <TextBlock Grid.Row="0" Grid.Column="2" 
                       Text="DisplayMemberPath:" 
                       Margin="5"/>
            <ComboBox x:Name="_displayMemberPath" 
                     Grid.Row="0" Grid.Column="3"
                     Width="125"
                     Margin="5"
                     HorizontalAlignment="Left"
                     ItemsSource="{StaticResource personProperties}"
                     SelectedIndex="1"/>
            <TextBlock Grid.Row="1"
                       Grid.Column="2"
                       Text="IsEditable:"
                       Margin="5" />
            <CheckBox x:Name="_isEditable"
                      Grid.Row="1"
                      Grid.Column="3"
                      Margin="5"
                      HorizontalAlignment="Left"
                      Content="(CheckComboBox only)"
                      ClickMode="Press"
                      IsChecked="{Binding IsEditable, ElementName=_checkComboBox}" />
            <TextBlock Grid.Row="2" Grid.Column="2" 
                       Text="IsDropDownOpen:" 
                       Margin="5"/>
            <CheckBox x:Name="_isDropDownOpen" 
                     Grid.Row="2" Grid.Column="3"
                     Margin="5"
                     HorizontalAlignment="Left"
                     Content="(CheckComboBox only)"
                     ClickMode="Press"
                     IsChecked="{Binding IsDropDownOpen, ElementName=_checkComboBox}" />
            <TextBlock Grid.Row="3" Grid.Column="2" 
                       Text="MaxDropDownHeight:" 
                       Margin="5"/>
            <StackPanel Orientation="Horizontal"
                        Grid.Row="3" Grid.Column="3"
                        HorizontalAlignment="Left"
                        Margin="5">
                <xctk:DoubleUpDown x:Name="_maxDropDownHeight"
                                   Width="45" 
                                   Value="{Binding MaxDropDownHeight, ElementName=_checkComboBox}"
                                   DefaultValue="150"
                                   AllowInputSpecialValues="PositiveInfinity"
                                   Minimum="0"/>
                <TextBlock Text="(CheckComboBox only)" 
                           Margin="4"/>
            </StackPanel>
         </Grid>
      </GroupBox>

      <GroupBox Header="Item Models" Grid.Row="1" Margin="5">
         <ListBox DisplayMemberPath="ModelDisplay" FontFamily="Global Monospace"
                  ItemsSource="{Binding}"/>
      </GroupBox>

      <Grid Grid.Row="2">
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>

         <TextBlock Text="CheckListBox Usage:" Margin="5" Style="{StaticResource Header}" />
         <xctk:CheckListBox x:Name="_checkListBox"
                            Grid.Column="0"
                            Grid.Row="1"
                            Margin="5"
                            VerticalAlignment="Stretch"
                            ItemsSource="{Binding}"
                            Delimiter="{Binding ElementName=_delimiter, Path=Text}"
                            ValueMemberPath="{Binding ElementName=_valueMemberPath, Path=SelectedItem}"
                            SelectedMemberPath="{Binding ElementName=_selectedMemberPath, Path=Text}"
                            DisplayMemberPath="{Binding ElementName=_displayMemberPath, Path=SelectedItem}" />

         <TextBlock Text="CheckComboBox Usage:" Grid.Column="1" Margin="5" Style="{StaticResource Header}"/>
         <xctk:CheckComboBox Grid.Column="1"
                             x:Name="_checkComboBox"
                             Grid.Row="1"
                             Margin="5"
                             VerticalAlignment="Top"
                             ItemsSource="{Binding}"
                             Delimiter="{Binding ElementName=_delimiter, Path=Text}"
                             ValueMemberPath="{Binding ElementName=_valueMemberPath, Path=SelectedItem}"
                             SelectedMemberPath="{Binding ElementName=_selectedMemberPath, Path=Text}"
                             DisplayMemberPath="{Binding ElementName=_displayMemberPath, Path=SelectedItem}" 
                             IsEditable="False"
                             IsDropDownOpen="false"
                             MaxDropDownHeight="100"/>
      </Grid>
   </Grid>
</local:DemoView>
